package com.hst.capacity.infra.persistence.jpa.franchisee.customer;

import com.hst.capacity.domain.model.entity.franchisee.customer.CustomerFranchiseeEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CustomerFranchiseeRepository extends JpaRepository<CustomerFranchiseeEntity, String> {

    @Query("select t from CustomerFranchiseeEntity t where t.idCustomer = ?1 and t.status = 1")
    List<CustomerFranchiseeEntity> findByIdCustomer(String idCustomer);

    @Query("select t.idFranchisee from CustomerFranchiseeEntity t where t.idCustomer = ?1 and t.status = 1")
    List<String> findIdFranchiseeByIdCustomer(String idCustomer);

    List<CustomerFranchiseeEntity> findByIdCustomerAndStatus(String idCustomer, int status);

}
